<{include file="scenter/block/header.html"}>
<div class="ucenter_t">
    <ul>
        <li><a href="<{link ctl='scenter/company:info'}>">公司设置</a></li>
        <{if $CONFIG.domain.company}>
        <li><a href="<{link ctl='scenter/company:domain'}>">个性域名</a></li>
        <{/if}>        
        <li class="on"><a href="<{link ctl='scenter/company/banner:index'}>">轮转广告</a></li>
        <li><a href="<{link ctl='scenter/company:skin'}>">公司模板</a></li> 
    </ul>
</div>
<div class="ucenter_c">
<{if $group.priv.allow_banner < 0}>
<p class="tips"><span class="lock">您是<b class="red">【<{$pager.audit_title}>】</b>不能添加轮转广告</span></p>
<{else}>
<div class="tips">
    <{if $pager.count<5}>
        <div class="SWF_Widget" rel="__SWF_Widget" params='{"submit":"true","company_id":"<{$company.company_id}>","OTOKEN":"<{$OTOKEN}>"}'>
            <span rel="__SWF_ctl" class="SWF_Ctl" style="float:left;">控件加载中...</span>
            <span style="display:none;" class="SWF_Loading" rel="l"><span rel="m"></span><span rel="n"></span></span>
        </div>
    <{else}>
        <b class="red">每个企业最多可以上传5张轮转广告图片</b>
    <{/if}>
</div>
<{/if}>
<form action="<{link ctl='scenter/company/banner:update'}>" mini-form="ucenter" method="post">
<table width="100%" border="0" cellspacing="0" class="table">
    <tr><th class="w-50">图片</th><th>标题</th><th>链接</th><th class="w-50">排序</th><th class="w-60">操作</th></tr>
        <{foreach $items as $item}>
        <tr>
            <td><img src="<{$pager.img}>/<{$item.photo}>" photo="<{$pager.img}>/<{$item.photo}>" class="wh-50" /></td>
            <td><input type="text" class="input w-200" name="data[<{$item.banner_id}>][title]" value="<{$item.title}>" /></td>
            <td><input type="text" class="input w-300" name="data[<{$item.banner_id}>][link]" value="<{$item.link}>" /></td>
            <td><input type="text" class="input w-50" name="data[<{$item.banner_id}>][orderby]" value="<{$item.orderby}>" /></td>
            <td><a href="<{link ctl='scenter/company/banner:delete' arg0=$item.banner_id}>" mini-act="confirm:您确定要删除该广告图片" class="pbtn red">删除</a> </td>
        </tr>
        <{foreachelse}>
         <tr><td colspan="20"><p class="tips"><span class="notice">您还没有添加店铺轮转广告</span></p></td></tr>
        <{/foreach}>
        <{if $pager.count}><tr><td colspan="3"></td><td><{if $group.priv.allow_banner < 0}><input type="button" value="没有权限" disabled="disabled" class="mpbtn" /><{else}><input type="submit" value="更新数据" class="mpbtn" /><{/if}></td><td></td></tr><{/if}>
</table>
</form>
</div>
<{if $pager.count<5}>
<script src="<{$pager.res}>/swfupload/swfupload.js" type="text/javascript"></script>
<script src="<{$pager.res}>/script/kt.upload.js" type="text/javascript"></script>
<script type="text/javascript">
(function(K, $){
$(document).ready(function(){
var Events = {
    upload_all_complete : function(event,files){
        Widget.MsgBox.success("全部图片上传完成！");
        window.location.reload(true);
    }
};
$("div[rel='__SWF_Widget']").each(function(){
    $(this).SWFUpload({
        file_size_limit : "10 MB",
        file_upload_limit : <{5-$pager.count}>,
        upload_url: "<{link ctl='scenter/company/banner:upload'}>",
        file_types : "*.jpg;*.gif;*.jpeg;*.png;",
        file_types_description : "添加图片",
        flash_url : "<{$pager.res}>/swfupload/swfupload.swf",
        button_image_url : "<{$pager.res}>/swfupload/photo.jpg",
        button_placeholder :$("[rel='__SWF_ctl']",this)[0],
        button_width: 84,
        button_height: 24,
        events:Events,
        debug : false
    });
});
});
})(window.KT, window.jQuery)
</script>
<{/if}>
<{if $group.priv.allow_banner < 0}>
<script type="text/javascript">
(function(K, $){
$(document).ready(function(){
$("[mini-form] input,[mini-form] select,[mini-form] textarea").attr("disabled", "disabled");
});
</script>
<{/if}>
<{include file="scenter/block/footer.html"}>